package 集合;

import java.util.Objects;

public class Student //implements Comparable<Student>
{
	private String name;
	private int id;
	private int grade;
	private int score;
	public Student() {
		super();
	}
	public Student(String name, int id, int grade, int score) {
		super();
		this.name = name;
		this.id = id;
		this.grade = grade;
		this.score = score;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getGrade() {
		return grade;
	}
	public void setGrade(int grade) {
		this.grade = grade;
	}
	public int getScore() {
		return score;
	}
	public void setScore(int score) {
		this.score = score;
	}
	@Override
	public String toString() {
		return "Student [姓名:" + name + ", 学号:" + id + ", 年级:" + grade + ", 分数:" + score + "]";
	}
//	@Override
//	public int compareTo(Student o) {
//		// TODO Auto-generated method stub
//		return this.score - o.score;
//	}
	@Override
	public int hashCode() {
		return Objects.hash(grade, id, name, score);
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Student other = (Student) obj;
		return grade == other.grade && id == other.id && Objects.equals(name, other.name) && score == other.score;
	}
}